﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/Visitor.master" AutoEventWireup="true" CodeFile="FindingBranch.aspx.cs" Inherits="Visitor_FindingBranch" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

<div id="head">
<asp:Label ID="Label1" runat="server" ForeColor="White" Text="Finding Branch" Font-Bold="True" Font-Size="Small" ></asp:Label>
</div>


<table class="style3" align="center" >
        <tr>
        <td class="style6" style="width: 12%">
                &nbsp;</td>
        <td class="style3" style="width: 152px">
            Select a City</td>
        <td>
            <asp:DropDownList ID="DropDownList4" runat="server" 
                DataSourceID="SqlDataSource3" DataTextField="CityName" 
                DataValueField="CityID" Width="170px" AutoPostBack="True">
                <asp:ListItem>Select a City</asp:ListItem>
            </asp:DropDownList>
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                ConnectionString="<%$ ConnectionStrings:OPOConnectionString %>" 
                SelectCommand="SELECT * FROM [City]"></asp:SqlDataSource>
        </td>
        <td>
                &nbsp;</td>
        </tr>
    <tr>
        <td class="style6" colspan="4">
            &nbsp;</td>
    </tr>
        <tr>
        <td class="style6" style="width: 12%">
            &nbsp;</td>
        <td class="style3" colspan="2">
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                CellPadding="4" DataKeyNames="BranchID" DataSourceID="SqlDataSource2" 
                EmptyDataText="There are no data records to display." ForeColor="#333333" 
                GridLines="None" AllowPaging="True">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:BoundField DataField="BranchName" HeaderText="BranchName" 
                        SortExpression="BranchName" />
                    <asp:BoundField DataField="BranchAddress" HeaderText="BranchAddress" 
                        SortExpression="BranchAddress" />
                    <asp:BoundField DataField="BranchPhone" HeaderText="BranchPhone" 
                        SortExpression="BranchPhone" />
                    <asp:BoundField DataField="BranchEmail" HeaderText="BranchEmail" 
                        SortExpression="BranchEmail" />
                </Columns>
                <EditRowStyle BackColor="#2461BF" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#EFF3FB" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#F5F7FB" />
                <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                <SortedDescendingCellStyle BackColor="#E9EBEF" />
                <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:OPOConnectionString %>" 
                DeleteCommand="DELETE FROM [Branch] WHERE [BranchID] = @BranchID" 
                InsertCommand="INSERT INTO [Branch] ([BranchID], [CityID], [BranchName], [BranchAddress], [BranchPhone], [BranchEmail]) VALUES (@BranchID, @CityID, @BranchName, @BranchAddress, @BranchPhone, @BranchEmail)" 
                ProviderName="<%$ ConnectionStrings:OPOConnectionString.ProviderName %>" 
                SelectCommand="SELECT [BranchID], [CityID], [BranchName], [BranchAddress], [BranchPhone], [BranchEmail] FROM [Branch] WHERE ([CityID] = @CityID)" 
                UpdateCommand="UPDATE [Branch] SET [CityID] = @CityID, [BranchName] = @BranchName, [BranchAddress] = @BranchAddress, [BranchPhone] = @BranchPhone, [BranchEmail] = @BranchEmail WHERE [BranchID] = @BranchID">
                <DeleteParameters>
                    <asp:Parameter Name="BranchID" Type="String" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="BranchID" Type="String" />
                    <asp:Parameter Name="CityID" Type="String" />
                    <asp:Parameter Name="BranchName" Type="String" />
                    <asp:Parameter Name="BranchAddress" Type="String" />
                    <asp:Parameter Name="BranchPhone" Type="String" />
                    <asp:Parameter Name="BranchEmail" Type="String" />
                </InsertParameters>
                <SelectParameters>
                    <asp:ControlParameter ControlID="DropDownList4" Name="CityID" 
                        PropertyName="SelectedValue" Type="String" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="CityID" Type="String" />
                    <asp:Parameter Name="BranchName" Type="String" />
                    <asp:Parameter Name="BranchAddress" Type="String" />
                    <asp:Parameter Name="BranchPhone" Type="String" />
                    <asp:Parameter Name="BranchEmail" Type="String" />
                    <asp:Parameter Name="BranchID" Type="String" />
                </UpdateParameters>
            </asp:SqlDataSource>
            </td>
        <td>
            &nbsp;</td>
        </tr>
    <tr>
        <td class="style6" style="width: 12%">
                &nbsp;</td>
        <td class="style4" style="width: 152px">
                &nbsp;</td>
        <td>
                &nbsp;</td>
        <td>
                &nbsp;</td>
    </tr>
    </table>
</asp:Content>

